home *** CD-ROM | disk | FTP | other *** search
- ' BOpen.Bas
- ' Portions Copyright 1987-1990 Microsoft Corp.
- DEFINT A-Z
- SUB ButtonOpen (handle, state, title$, row1, col1, row2, col2, buttonType)
-
- ' =======================================================================
- ' Open a button - first check if window can be resized - If so, do not
- ' open!
- ' =======================================================================
-
- IF MID$(WindowBorder$(GloWindow(WindowCurrent).windowType), 9, 1) _
- = "+" THEN
- resize = TRUE
- END IF
-
- ' =======================================================================
- ' Check to see if this is a button type 5 (box-type command button). If
- ' so, see if row2 and col2 need adjustment
- ' =======================================================================
-
- IF buttonType = 5 THEN
- IF row2 = 0 THEN
- row2 = row1 + 2
- END IF
- IF col2 = 0 THEN
- col2 = col1 + LEN(title$) + 3
- END IF
- END IF
-
- IF (resize AND buttonType >= 6) OR NOT resize THEN
-
- ' ===================================================================
- ' If scroll bar, then make sure "state" is valid, given bar length
- ' ===================================================================
-
- IF buttonType = 6 THEN
- length = (row2 - row1) - 1
- IF state < 1 THEN state = 1
- IF state > length THEN state = length
- END IF
-
- IF buttonType = 7 THEN
- length = (col2 - col1) - 1
- IF state < 1 THEN state = 1
- IF state > length THEN state = length
- END IF
-
-
- ' ===================================================================
- ' If valid state and type, increment totals, and store button info
- ' ===================================================================
-
- IF (buttonType = 1 AND state >= 1 AND state <= 3) OR _
- (buttonType >= 2 AND buttonType <= 3 AND state >= 1 AND state <= 2) _
- OR (buttonType >= 4 AND buttonType <= 7) THEN
- ButtonClose handle
-
- GloStorage.numButtonsOpen = GloStorage.numButtonsOpen + 1
- GloButton(GloStorage.numButtonsOpen).row1 = row1
- GloButton(GloStorage.numButtonsOpen).col1 = col1
- GloButton(GloStorage.numButtonsOpen).row2 = row2
- GloButton(GloStorage.numButtonsOpen).col2 = col2
- GloButton(GloStorage.numButtonsOpen).text = title$
- GloButton(GloStorage.numButtonsOpen).state = state
- GloButton(GloStorage.numButtonsOpen).handle = handle
- GloButton(GloStorage.numButtonsOpen).buttonType = buttonType
- GloButton(GloStorage.numButtonsOpen).windowHandle = WindowCurrent
- ButtonShow handle
- ELSE
- PRINT "Cannot open button on window that can be re-sized!"
- END
- END IF
- END IF
- END SUB